<!DOCTYPE html>
<html>
<head>
    <title>SVG to PNG Converter</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
        }
        .icon-container {
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
            margin-bottom: 30px;
        }
        .icon-item {
            border: 1px solid #ddd;
            padding: 10px;
            border-radius: 5px;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        button {
            padding: 10px 15px;
            background-color: #4CB050;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            margin-top: 10px;
        }
        canvas {
            border: 1px dashed #ccc;
            margin-top: 5px;
        }
    </style>
</head>
<body>
    <h1>SVG to PNG Converter for TabBar Icons</h1>
    <p>Click on each "Convert" button to convert the SVG to PNG, then right-click on the canvas and select "Save Image As..." to save the PNG file.</p>
    
    <div class="icon-container" id="iconContainer">
        <!-- Icons will be loaded here -->
    </div>

    <script>
        // List of SVG files to convert
        const icons = [
            'home', 'homeActive',
            'campsite', 'campsiteActive',
            'publish', 'publishActive',
            'message', 'messageActive',
            'profile', 'profileActive'
        ];

        const iconContainer = document.getElementById('iconContainer');

        // Create elements for each icon
        icons.forEach(iconName => {
            const iconItem = document.createElement('div');
            iconItem.className = 'icon-item';
            
            const title = document.createElement('h3');
            title.textContent = iconName;
            
            const img = document.createElement('img');
            img.src = `./${iconName}.svg`;
            img.width = 48;
            img.height = 48;
            img.id = `svg-${iconName}`;
            
            const canvas = document.createElement('canvas');
            canvas.width = 48;
            canvas.height = 48;
            canvas.id = `canvas-${iconName}`;
            
            const button = document.createElement('button');
            button.textContent = 'Convert to PNG';
            button.onclick = () => convertToPng(iconName);
            
            iconItem.appendChild(title);
            iconItem.appendChild(img);
            iconItem.appendChild(canvas);
            iconItem.appendChild(button);
            
            iconContainer.appendChild(iconItem);
        });

        // Function to convert SVG to PNG
        function convertToPng(iconName) {
            const svg = document.getElementById(`svg-${iconName}`);
            const canvas = document.getElementById(`canvas-${iconName}`);
            const ctx = canvas.getContext('2d');
            
            // Clear canvas
            ctx.clearRect(0, 0, canvas.width, canvas.height);
            
            // Create image from SVG
            const img = new Image();
            img.onload = function() {
                ctx.drawImage(img, 0, 0, 48, 48);
                alert(`${iconName}.png is ready! Right-click on the canvas and select "Save Image As..." to save it.`);
            };
            img.src = `./${iconName}.svg`;
        }
    </script>
</body>
</html> 